import pymysql
class DB:
    #初始化
    def __init__(self):
            self.conn = pymysql.connect(host='localhost',port=3306,user='root',password='root',db='md',charset='utf8',cursorclass=pymysql.cursors.DictCursor)
            self.coursor = self.conn.cursor()
    #查找所有
    def findall(self,sql):
        self.coursor.execute(sql)
        return 'finall ok'

    #查找单个
    def findone(self,sql):
        self.coursor.execute(sql)
        return 'finone ok'

    def insert(self,sql):
        self.coursor.execute(sql)
        self.conn.commit()
        return 'insert ok'
    #关闭
    def close(self):
        self.coursor.close()
        self.conn.close()

db = DB()
db.insert("insert into student values()")